<!-- inc:header -->
<div class="notice"><div class="p">
	<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td width="130px"><span class="lead">&nbsp;&raquo; 数据联动</span></td>
		<form method="post" action="{:site_url('datalink,groupok')}">
		<td align="left">
			<select name="groupid" id="groupid" onchange="reload_gid(this.value)">
			<option value="0">全部组</option>
			<!-- $grouplist AS $key=>$value -->
			<option value="{:$value[id]}"{if($groupid == $value['id'])} selected{end}>{:$value[title]}</option>
			<!-- end -->
			</select>
			&nbsp; &nbsp; 
			<!-- if($groupid) -->编辑<!-- else -->添加新<!-- end -->组名称：
			<input type="text" name="groupname" id="groupname" value="{:$groupname}">
			<input type="submit" class="button" value="提交">
			<!-- if($groupid) -->
			<input type="button" onclick="group_del({:$groupid})" value="删除当前组" class="button">
			<!-- end -->
		</td>
		</form>
		<td align="right"><a href="{:site_url('datalink,set')}" class="button">添加联动信息</a></td>
	</tr>
	</table>
</div></div>

<div class="main">
<table width="100%" style="layout:fixed;" cellpadding="0" cellspacing="0">
<tr>
	<td class="t_sub">ID</td>
	<td class="t_sub">有效值</td>
	<td class="t_sub">名称</td>
	<td class="t_sub">组</td>
	<td class="t_sub">排序</td>
	<td class="t_sub">删除</td>
</tr>
<!-- $rslist AS $key=>$value -->
<tr class="tr_out" onMouseOver="over_tr(this)" onMouseOut="out_tr(this)">
	<td align='center' class="tc_left" height="25px">{:$value[id]}</td>
	<td align="center" class="tc_right">{:$value[val]}</td>
	<td  align='left' class="tc_right">&nbsp;<!-- if($value[p_title]) -->{:$value[p_title]} - <!-- end -->{:$value[title]}</td>
	<td align="center" class="tc_right"><!-- if($value[g_title]) -->{:$value[g_title]}<!-- else -->-<!-- end --></td>
	<td align="center" class="tc_right">{:$value[taxis]}</td>
	<td align="center" class="tc_right">
		<a href="{:site_url('datalink,set')}id={:$value[id]}"><img src="images/page_edit.gif" alt="编辑"></a>
		<a href="javascript:f_del({:$value['id']});void(0);"><img src="images/page_delete.gif" alt="删除"></a>
	</td>
</tr>
<!-- end -->
</table>
</div>
<!-- if($pagelist) --><div class="table">{:$pagelist}</div><!-- end -->
<script type="text/javascript">
//删除组
function group_del(id)
{
	var q = confirm("确定要删除当前组吗？删除后该组下的所有信息都将被删除");
	if(q != "0")
	{
		window.location.href = "{:site_url('datalink,groupdel')}id="+id;
		return true;
	}
	return true;
}
//删除字段
function f_del(id)
{
	var q = confirm("确定要删除当前组吗？删除后该值将同时删除这个值下的所有子值信息");
	if(q != "0")
	{
		var url = "{:site_url('datalink,ajaxdel')}id="+id;
		var msg = get_ajax(url);
		if(msg == "ok")
		{
			window.location.href = window.location.href;
		}
		else
		{
			if(!msg) msg = "Error:错误";
			alert(msg);
			return false;
		}
	}
	return true;
}
//重加载
function reload_gid(val)
{
	var url = "{:site_url('datalink')}groupid="+val;
	window.location.href = url;
}
</script>
<!-- inc:footer -->